#ifndef __INCLUDED_EVEREST_ODBC_CONNECTION_H
#define __INCLUDED_EVEREST_ODBC_CONNECTION_H

#include <everest/basedef.h>
#include <sql.h>
#include <sqlext.h>
BEGIN_NAMESPACE_EVEREST

namespace odbc
{
	class Environment;

	/**
	 * @brief The ODBC Connection class
	 */
	class Connection
	{
	public:
		Connection();                   /// \brief default constructor, and uses default global environment instance
		Connection(Environment& env);
		virtual ~Connection();

		SQLHDBC getHandle() const;
		bool open(const char *pszConnStr);
		void close();
		void setAutoCommit(bool bAutoCommit);
		bool getAutoCommit() const;
		void commit();
		void rollback();
		bool isActive() const;

	protected:
		SQLHDBC m_ConHandle;
	};
	typedef CommonPtr<Connection> ConnectionPtr;

} // end of namespace odbc

END_NAMESPACE_EVEREST

#endif // __INCLUDED_EVEREST_ODBC_CONNECTION_H
